//@charset "utf-8";
// 搜索历史
define(function (require, exports, module) {
	var ClientBaseModel = require('./clientbase');
	var HistoryModel = ClientBaseModel.extend({
		file : 'historyquery.log',
		saveHistoryData : function (query) {
			var onceHistoryQueryList = this.getData();
			var nowHistoryQueryList = [];

			nowHistoryQueryList.push(query);

			if (false !== onceHistoryQueryList) {
				var index = 1;
				for (var i in onceHistoryQueryList) {
					var onceHistoryQueryItem = onceHistoryQueryList[i];
					if (onceHistoryQueryItem === query) {
						continue;
					}
					if (index++ >= 6) {
						break;
					}
					
					nowHistoryQueryList.push(onceHistoryQueryItem);
				}
			}

			this.saveData(nowHistoryQueryList);
		}
	});
  
	module.exports = new HistoryModel();
});
